/*
 * Filename TestStripPriceProfitSchemeRepositoryImpl.java 2022年03月24日
 * Copyright © Ehome Co.Ltd. All Rgiths Reserved.
 * @author wuyingchao
 */
package com.ehome.poct.core.dao.mybatis;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ehome.mybatisplus.support.AbstractCrudRepository;
import com.ehome.poct.core.api.dto.check.gold.TestConfPoctStripTypeDTO;
import com.ehome.poct.core.api.dto.order.TestStripPriceProfitDTO;
import com.ehome.poct.core.dao.entity.check.TestConfPoctStripTypeDO;
import com.ehome.poct.core.dao.entity.order.TestStripPriceProfitsDO;
import com.ehome.poct.core.dao.mapping.TestStripPriceProfitsMapping;
import com.ehome.poct.core.dao.mybatis.mapper.TestConfPoctStripTypeMapper;
import com.ehome.poct.core.dao.mybatis.mapper.order.TestStripPriceProfitsMapper;
import com.ehome.poct.core.repository.order.TestStripPriceProfitRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author wyc
 * @since 2022/03/24 15:42
 **/
@Repository
@AllArgsConstructor
public class TestStripPriceProfitRepositoryImpl extends AbstractCrudRepository<TestStripPriceProfitsDO, TestStripPriceProfitDTO> implements TestStripPriceProfitRepository {
    private final TestStripPriceProfitsMapper testStripPriceProfitsMapper;
    private final TestConfPoctStripTypeMapper testConfPoctStripTypeMapper;
    private final TestStripPriceProfitsMapping testStripPriceProfitsMapping;

    @Override
    public List<TestConfPoctStripTypeDTO> getDetections(){
        var detections = testConfPoctStripTypeMapper.selectList(Wrappers.<TestConfPoctStripTypeDO>lambdaQuery().ne(TestConfPoctStripTypeDO::getTypeCode,0).orderByAsc(TestConfPoctStripTypeDO::getTypeCode));
        return testStripPriceProfitsMapping.to(detections);
    }

    @Override
    public void deleteProfitById(Long profitSchemeId) {
        testStripPriceProfitsMapper.testStripPriceProfitsMapper(profitSchemeId);
    }
}